2000W / 48V LLC Battery-Charger  V1.00

Inter Integrated Circuit(IIC) driver for the XMC microcontroller family. More...

Collaboration diagram for I2C:

Classes

struct  XMC_I2C_CH_CONFIG
 I2C_CH configuration structure. More...
 

Macros

#define XMC_I2C_10BIT_ADDR_GROUP   (0x7800U)
 

Typedefs

typedef enum XMC_I2C_CH_STATUS XMC_I2C_CH_STATUS_t
 I2C Status. More...
 
typedef enum XMC_I2C_CH_STATUS_FLAG XMC_I2C_CH_STATUS_FLAG_t
 I2C status. More...
 
typedef enum XMC_I2C_CH_RECEIVER_STATUS_FLAG XMC_I2C_CH_RECEIVER_STATUS_FLAG_t
 I2C receiver status. The received data byte is available at the bit positions RBUF[7:0], whereas the additional information is monitored at the bit positions RBUF[12:8]. More...
 
typedef enum XMC_I2C_CH_CMD XMC_I2C_CH_CMD_t
 I2C commands. More...
 
typedef enum XMC_I2C_CH_EVENT XMC_I2C_CH_EVENT_t
 I2C events. More...
 
typedef enum XMC_I2C_CH_INPUT XMC_I2C_CH_INPUT_t
 I2C input stage selection. More...
 
typedef enum XMC_I2C_CH_INTERRUPT_NODE_POINTER XMC_I2C_CH_INTERRUPT_NODE_POINTER_t
 
typedef struct XMC_I2C_CH_CONFIG XMC_I2C_CH_CONFIG_t
 I2C_CH configuration structure. More...
 

Enumerations

enum  XMC_I2C_CH_STATUS { XMC_I2C_CH_STATUS_OK, XMC_I2C_CH_STATUS_ERROR, XMC_I2C_CH_STATUS_BUSY }
 I2C Status. More...
 
enum  XMC_I2C_CH_STATUS_FLAG {
  XMC_I2C_CH_STATUS_FLAG_SLAVE_SELECT = USIC_CH_PSR_IICMode_SLSEL_Msk, XMC_I2C_CH_STATUS_FLAG_WRONG_TDF_CODE_FOUND = USIC_CH_PSR_IICMode_WTDF_Msk, XMC_I2C_CH_STATUS_FLAG_START_CONDITION_RECEIVED = USIC_CH_PSR_IICMode_SCR_Msk, XMC_I2C_CH_STATUS_FLAG_REPEATED_START_CONDITION_RECEIVED = USIC_CH_PSR_IICMode_RSCR_Msk,
  XMC_I2C_CH_STATUS_FLAG_STOP_CONDITION_RECEIVED = USIC_CH_PSR_IICMode_PCR_Msk, XMC_I2C_CH_STATUS_FLAG_NACK_RECEIVED = USIC_CH_PSR_IICMode_NACK_Msk, XMC_I2C_CH_STATUS_FLAG_ARBITRATION_LOST = USIC_CH_PSR_IICMode_ARL_Msk, XMC_I2C_CH_STATUS_FLAG_SLAVE_READ_REQUESTED = USIC_CH_PSR_IICMode_SRR_Msk,
  XMC_I2C_CH_STATUS_FLAG_ERROR = USIC_CH_PSR_IICMode_ERR_Msk, XMC_I2C_CH_STATUS_FLAG_ACK_RECEIVED = USIC_CH_PSR_IICMode_ACK_Msk, XMC_I2C_CH_STATUS_FLAG_RECEIVER_START_INDICATION = USIC_CH_PSR_IICMode_RSIF_Msk, XMC_I2C_CH_STATUS_FLAG_DATA_LOST_INDICATION = USIC_CH_PSR_IICMode_DLIF_Msk,
  XMC_I2C_CH_STATUS_FLAG_TRANSMIT_SHIFT_INDICATION = USIC_CH_PSR_IICMode_TSIF_Msk, XMC_I2C_CH_STATUS_FLAG_TRANSMIT_BUFFER_INDICATION = USIC_CH_PSR_IICMode_TBIF_Msk, XMC_I2C_CH_STATUS_FLAG_RECEIVE_INDICATION = USIC_CH_PSR_IICMode_RIF_Msk, XMC_I2C_CH_STATUS_FLAG_ALTERNATIVE_RECEIVE_INDICATION = USIC_CH_PSR_IICMode_AIF_Msk,
  XMC_I2C_CH_STATUS_FLAG_BAUD_RATE_GENERATOR_INDICATION = USIC_CH_PSR_IICMode_BRGIF_Msk
}
 I2C status. More...
 
enum  XMC_I2C_CH_RECEIVER_STATUS_FLAG {
  XMC_I2C_CH_RECEIVER_STATUS_FLAG_ACK = 0x1U, XMC_I2C_CH_RECEIVER_STATUS_FLAG_FIN = 0x2U, XMC_I2C_CH_RECEIVER_STATUS_FLAG_MODE = 0x4U, XMC_I2C_CH_RECEIVER_STATUS_FLAG_ERR = 0x8U,
  XMC_I2C_CH_RECEIVER_STATUS_FLAG_ADR = 0x10
}
 I2C receiver status. The received data byte is available at the bit positions RBUF[7:0], whereas the additional information is monitored at the bit positions RBUF[12:8]. More...
 
enum  XMC_I2C_CH_CMD { XMC_I2C_CH_CMD_WRITE, XMC_I2C_CH_CMD_READ }
 I2C commands. More...
 
enum  XMC_I2C_CH_EVENT {
  XMC_I2C_CH_EVENT_RECEIVE_START = USIC_CH_CCR_RSIEN_Msk, XMC_I2C_CH_EVENT_DATA_LOST = USIC_CH_CCR_DLIEN_Msk, XMC_I2C_CH_EVENT_TRANSMIT_SHIFT = USIC_CH_CCR_TSIEN_Msk, XMC_I2C_CH_EVENT_TRANSMIT_BUFFER = USIC_CH_CCR_TBIEN_Msk,
  XMC_I2C_CH_EVENT_STANDARD_RECEIVE = USIC_CH_CCR_RIEN_Msk, XMC_I2C_CH_EVENT_ALTERNATIVE_RECEIVE = USIC_CH_CCR_AIEN_Msk, XMC_I2C_CH_EVENT_BAUD_RATE_GENERATOR = USIC_CH_CCR_BRGIEN_Msk, XMC_I2C_CH_EVENT_START_CONDITION_RECEIVED = USIC_CH_PCR_IICMode_SCRIEN_Msk,
  XMC_I2C_CH_EVENT_REPEATED_START_CONDITION_RECEIVED = USIC_CH_PCR_IICMode_RSCRIEN_Msk, XMC_I2C_CH_EVENT_STOP_CONDITION_RECEIVED = USIC_CH_PCR_IICMode_PCRIEN_Msk, XMC_I2C_CH_EVENT_NACK = USIC_CH_PCR_IICMode_NACKIEN_Msk, XMC_I2C_CH_EVENT_ARBITRATION_LOST = USIC_CH_PCR_IICMode_ARLIEN_Msk,
  XMC_I2C_CH_EVENT_SLAVE_READ_REQUEST = USIC_CH_PCR_IICMode_SRRIEN_Msk, XMC_I2C_CH_EVENT_ERROR = USIC_CH_PCR_IICMode_ERRIEN_Msk, XMC_I2C_CH_EVENT_ACK = USIC_CH_PCR_IICMode_ACKIEN_Msk
}
 I2C events. More...
 
enum  XMC_I2C_CH_INPUT { XMC_I2C_CH_INPUT_SDA = 0U, XMC_I2C_CH_INPUT_SCL = 1U }
 I2C input stage selection. More...
 
enum  XMC_I2C_CH_INTERRUPT_NODE_POINTER {
  XMC_I2C_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT = XMC_USIC_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT, XMC_I2C_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER = XMC_USIC_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER, XMC_I2C_CH_INTERRUPT_NODE_POINTER_RECEIVE = XMC_USIC_CH_INTERRUPT_NODE_POINTER_RECEIVE, XMC_I2C_CH_INTERRUPT_NODE_POINTER_ALTERNATE_RECEIVE = XMC_USIC_CH_INTERRUPT_NODE_POINTER_ALTERNATE_RECEIVE,
  XMC_I2C_CH_INTERRUPT_NODE_POINTER_PROTOCOL = XMC_USIC_CH_INTERRUPT_NODE_POINTER_PROTOCOL
}
 

Functions

void XMC_I2C_CH_Init (XMC_USIC_CH_t *const channel, const XMC_I2C_CH_CONFIG_t *const config)
 
XMC_I2C_CH_STATUS_t XMC_I2C_CH_SetBaudrate (XMC_USIC_CH_t *const channel, const uint32_t rate)
 
__STATIC_INLINE void XMC_I2C_CH_Start (XMC_USIC_CH_t *const channel)
 
XMC_I2C_CH_STATUS_t XMC_I2C_CH_Stop (XMC_USIC_CH_t *const channel)
 
__STATIC_INLINE void XMC_I2C_CH_SetInterruptNodePointer (XMC_USIC_CH_t *const channel, const uint8_t service_request)
 
__STATIC_INLINE void XMC_I2C_CH_SelectInterruptNodePointer (XMC_USIC_CH_t *const channel, const XMC_I2C_CH_INTERRUPT_NODE_POINTER_t interrupt_node, const uint32_t service_request)
 
__STATIC_INLINE void XMC_I2C_CH_TriggerServiceRequest (XMC_USIC_CH_t *const channel, const uint32_t service_request_line)
 
__STATIC_INLINE void XMC_I2C_CH_SetInputSource (XMC_USIC_CH_t *const channel, const XMC_I2C_CH_INPUT_t input, const uint8_t source)
 
void XMC_I2C_CH_SetSlaveAddress (XMC_USIC_CH_t *const channel, const uint16_t address)
 
uint16_t XMC_I2C_CH_GetSlaveAddress (const XMC_USIC_CH_t *const channel)
 
void XMC_I2C_CH_MasterStart (XMC_USIC_CH_t *const channel, const uint16_t addr, const XMC_I2C_CH_CMD_t command)
 
void XMC_I2C_CH_MasterRepeatedStart (XMC_USIC_CH_t *const channel, const uint16_t addr, const XMC_I2C_CH_CMD_t command)
 
void XMC_I2C_CH_MasterStop (XMC_USIC_CH_t *const channel)
 
void XMC_I2C_CH_MasterTransmit (XMC_USIC_CH_t *const channel, const uint8_t data)
 
void XMC_I2C_CH_SlaveTransmit (XMC_USIC_CH_t *const channel, const uint8_t data)
 
void XMC_I2C_CH_MasterReceiveAck (XMC_USIC_CH_t *const channel)
 
void XMC_I2C_CH_MasterReceiveNack (XMC_USIC_CH_t *const channel)
 
uint8_t XMC_I2C_CH_GetReceivedData (const XMC_USIC_CH_t *const channel)
 
__STATIC_INLINE uint8_t XMC_I2C_CH_GetReceiverStatusFlag (XMC_USIC_CH_t *const channel)
 
void XMC_I2C_CH_EnableEvent (XMC_USIC_CH_t *const channel, uint32_t event)
 
void XMC_I2C_CH_DisableEvent (XMC_USIC_CH_t *const channel, uint32_t event)
 
__STATIC_INLINE uint32_t XMC_I2C_CH_GetStatusFlag (XMC_USIC_CH_t *const channel)
 
__STATIC_INLINE void XMC_I2C_CH_ClearStatusFlag (XMC_USIC_CH_t *const channel, uint32_t flag)
 
__STATIC_INLINE void XMC_I2C_CH_ConfigExternalInputSignalToBRG (XMC_USIC_CH_t *const channel, const uint16_t pdiv, const uint32_t oversampling, const XMC_USIC_CH_INPUT_COMBINATION_MODE_t combination_mode)
 
__STATIC_INLINE void XMC_I2C_CH_EnableAcknowledgeAddress0 (XMC_USIC_CH_t *const channel)
 
__STATIC_INLINE void XMC_I2C_CH_DisableAcknowledgeAddress0 (XMC_USIC_CH_t *const channel)
 
__STATIC_INLINE void XMC_I2C_CH_EnableDataTransmission (XMC_USIC_CH_t *const channel)
 
__STATIC_INLINE void XMC_I2C_CH_DisableDataTransmission (XMC_USIC_CH_t *const channel)
 
__STATIC_INLINE void XMC_I2C_CH_EnableMasterClock (XMC_USIC_CH_t *const channel)
 
__STATIC_INLINE void XMC_I2C_CH_DisableMasterClock (XMC_USIC_CH_t *const channel)
 

Detailed Description

Inter Integrated Circuit(IIC) driver for the XMC microcontroller family.

USIC IIC Features:

Macro Definition Documentation

◆ XMC_I2C_10BIT_ADDR_GROUP

#define XMC_I2C_10BIT_ADDR_GROUP   (0x7800U)

Value to verify the address is 10-bit or not

Definition at line 131 of file xmc_i2c.h.

Typedef Documentation

◆ XMC_I2C_CH_CMD_t

I2C commands.

◆ XMC_I2C_CH_CONFIG_t

I2C_CH configuration structure.

◆ XMC_I2C_CH_EVENT_t

I2C events.

◆ XMC_I2C_CH_INPUT_t

I2C input stage selection.

◆ XMC_I2C_CH_INTERRUPT_NODE_POINTER_t

I2C channel interrupt node pointers

◆ XMC_I2C_CH_RECEIVER_STATUS_FLAG_t

I2C receiver status. The received data byte is available at the bit positions RBUF[7:0], whereas the additional information is monitored at the bit positions RBUF[12:8].

◆ XMC_I2C_CH_STATUS_FLAG_t

◆ XMC_I2C_CH_STATUS_t

I2C Status.

Enumeration Type Documentation

◆ XMC_I2C_CH_CMD

I2C commands.

Enumerator
XMC_I2C_CH_CMD_WRITE 

I2C Command Write

XMC_I2C_CH_CMD_READ 

I2C Command Read

Definition at line 193 of file xmc_i2c.h.

◆ XMC_I2C_CH_EVENT

I2C events.

Enumerator
XMC_I2C_CH_EVENT_RECEIVE_START 

Receive start event

XMC_I2C_CH_EVENT_DATA_LOST 

Data lost event

XMC_I2C_CH_EVENT_TRANSMIT_SHIFT 

Transmit shift event

XMC_I2C_CH_EVENT_TRANSMIT_BUFFER 

Transmit buffer event

XMC_I2C_CH_EVENT_STANDARD_RECEIVE 

Receive event

XMC_I2C_CH_EVENT_ALTERNATIVE_RECEIVE 

Alternate receive event

XMC_I2C_CH_EVENT_BAUD_RATE_GENERATOR 

Baudrate generator event

XMC_I2C_CH_EVENT_START_CONDITION_RECEIVED 

Start condition received event

XMC_I2C_CH_EVENT_REPEATED_START_CONDITION_RECEIVED 

Repeated start condition received event

XMC_I2C_CH_EVENT_STOP_CONDITION_RECEIVED 

Stop condition received event

XMC_I2C_CH_EVENT_NACK 

NACK received event

XMC_I2C_CH_EVENT_ARBITRATION_LOST 

Arbitration lost event

XMC_I2C_CH_EVENT_SLAVE_READ_REQUEST 

Slave read request event

XMC_I2C_CH_EVENT_ERROR 

Error condition event

XMC_I2C_CH_EVENT_ACK 

ACK received event

Definition at line 202 of file xmc_i2c.h.

◆ XMC_I2C_CH_INPUT

I2C input stage selection.

Enumerator
XMC_I2C_CH_INPUT_SDA 

selection of sda input stage

XMC_I2C_CH_INPUT_SCL 

selection of scl input stage

Definition at line 225 of file xmc_i2c.h.

◆ XMC_I2C_CH_INTERRUPT_NODE_POINTER

I2C channel interrupt node pointers

Enumerator
XMC_I2C_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT 

Node pointer for transmit shift interrupt

XMC_I2C_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER 

Node pointer for transmit buffer interrupt

XMC_I2C_CH_INTERRUPT_NODE_POINTER_RECEIVE 

Node pointer for receive interrupt

XMC_I2C_CH_INTERRUPT_NODE_POINTER_ALTERNATE_RECEIVE 

Node pointer for alternate receive interrupt

XMC_I2C_CH_INTERRUPT_NODE_POINTER_PROTOCOL 

Node pointer for protocol related interrupts

Definition at line 241 of file xmc_i2c.h.

◆ XMC_I2C_CH_RECEIVER_STATUS_FLAG

I2C receiver status. The received data byte is available at the bit positions RBUF[7:0], whereas the additional information is monitored at the bit positions RBUF[12:8].

Enumerator
XMC_I2C_CH_RECEIVER_STATUS_FLAG_ACK 

Bit 8: Value of Received Acknowledgement bit

XMC_I2C_CH_RECEIVER_STATUS_FLAG_FIN 

Bit 9: A 1 at this bit position indicates that after a (repeated) start condition followed by the address reception the first data byte of a new frame has been received. A 0 at this bit position indicates further data bytes

XMC_I2C_CH_RECEIVER_STATUS_FLAG_MODE 

Bit 10: A 0 at this bit position indicates that the data byte has been received when the device has been in slave mode, whereas a 1 indicates a reception in master mode

XMC_I2C_CH_RECEIVER_STATUS_FLAG_ERR 

Bit 11: A 1 at this bit position indicates an incomplete/erroneous data byte in the receive buffer

XMC_I2C_CH_RECEIVER_STATUS_FLAG_ADR 

Bit 12: A 0 at this bit position indicates that the programmed address has been received. A 1 indicates a general call address.

Definition at line 176 of file xmc_i2c.h.

◆ XMC_I2C_CH_STATUS

I2C Status.

Enumerator
XMC_I2C_CH_STATUS_OK 

Status OK

XMC_I2C_CH_STATUS_ERROR 

Status ERROR

XMC_I2C_CH_STATUS_BUSY 

Status BUSY

Definition at line 140 of file xmc_i2c.h.

◆ XMC_I2C_CH_STATUS_FLAG

I2C status.

Enumerator
XMC_I2C_CH_STATUS_FLAG_SLAVE_SELECT 

Slave select status

XMC_I2C_CH_STATUS_FLAG_WRONG_TDF_CODE_FOUND 

Wrong TDF status

XMC_I2C_CH_STATUS_FLAG_START_CONDITION_RECEIVED 

Start condition received status

XMC_I2C_CH_STATUS_FLAG_REPEATED_START_CONDITION_RECEIVED 

Repeated start condition received status

XMC_I2C_CH_STATUS_FLAG_STOP_CONDITION_RECEIVED 

Stop condition received status

XMC_I2C_CH_STATUS_FLAG_NACK_RECEIVED 

NACK received status

XMC_I2C_CH_STATUS_FLAG_ARBITRATION_LOST 

Arbitration lost status

XMC_I2C_CH_STATUS_FLAG_SLAVE_READ_REQUESTED 

Slave read requested status

XMC_I2C_CH_STATUS_FLAG_ERROR 

Error status

XMC_I2C_CH_STATUS_FLAG_ACK_RECEIVED 

ACK received status

XMC_I2C_CH_STATUS_FLAG_RECEIVER_START_INDICATION 

Receive start indication status

XMC_I2C_CH_STATUS_FLAG_DATA_LOST_INDICATION 

Data lost indication status

XMC_I2C_CH_STATUS_FLAG_TRANSMIT_SHIFT_INDICATION 

Transmit shift indication status

XMC_I2C_CH_STATUS_FLAG_TRANSMIT_BUFFER_INDICATION 

Transmit buffer indication status

XMC_I2C_CH_STATUS_FLAG_RECEIVE_INDICATION 

Receive indication status

XMC_I2C_CH_STATUS_FLAG_ALTERNATIVE_RECEIVE_INDICATION 

Alternate receive indication status

XMC_I2C_CH_STATUS_FLAG_BAUD_RATE_GENERATOR_INDICATION 

Baud rate generator indication status

Definition at line 150 of file xmc_i2c.h.

Function Documentation

◆ XMC_I2C_CH_ClearStatusFlag()

__STATIC_INLINE void XMC_I2C_CH_ClearStatusFlag ( XMC_USIC_CH_t *const  channel,
uint32_t  flag 
)
Parameters
channelConstant pointer to USIC channel structure of type XMC_USIC_CH_t
flagStatus flag
Returns
None
Description:
Clears the status flag of I2C channel by setting the input parameter flag in PSCR register.
Related APIs:
XMC_I2C_CH_GetStatusFlag()

Definition at line 676 of file xmc_i2c.h.

Referenced by XMC_I2C_CH_MasterReceiveAck(), XMC_I2C_CH_MasterReceiveNack(), XMC_I2C_CH_MasterStop(), XMC_I2C_CH_MasterTransmit(), and XMC_I2C_CH_SlaveTransmit().

Here is the caller graph for this function:

◆ XMC_I2C_CH_ConfigExternalInputSignalToBRG()

__STATIC_INLINE void XMC_I2C_CH_ConfigExternalInputSignalToBRG ( XMC_USIC_CH_t *const  channel,
const uint16_t  pdiv,
const uint32_t  oversampling,
const XMC_USIC_CH_INPUT_COMBINATION_MODE_t  combination_mode 
)
Parameters
channelPointer to USIC channel handler of type XMC_USIC_CH_t
Range: XMC_I2C0_CH0, XMC_I2C0_CH1,XMC_I2C1_CH0,XMC_I2C1_CH1,XMC_I2C2_CH0,XMC_I2C2_CH1
Note
Availability of I2C1 and I2C2 depends on device selection
Parameters
pdivDesired divider for the external frequency input. Range: minimum value = 1, maximum value = 1024
oversamplingRequired oversampling. The value indicates the number of time quanta for one symbol of data.
This can be related to the number of samples for each logic state of the data signal.
Range: 1 to 32. Value should be chosen based on the protocol used.
combination_modeUSIC channel input combination mode
Returns
None
Description
Enables the external frequency input for the Baudrate Generator and configures the divider, oversampling and the combination mode of the USIC channel.

Related APIs:
XMC_USIC_CH_SetBRGInputClockSource(), XMC_USIC_CH_SetInputTriggerCombinationMode()


Definition at line 699 of file xmc_i2c.h.

Here is the call graph for this function:

◆ XMC_I2C_CH_DisableAcknowledgeAddress0()

__STATIC_INLINE void XMC_I2C_CH_DisableAcknowledgeAddress0 ( XMC_USIC_CH_t *const  channel)
Parameters
channelConstant pointer to USIC channel structure of type XMC_USIC_CH_t
Returns
None
Description:
This bit defines that slave device should not be sensitive to the slave address 00H.
Related APIs:
XMC_I2C_CH_EnableAcknowledgeAddress0()

Definition at line 732 of file xmc_i2c.h.

◆ XMC_I2C_CH_DisableDataTransmission()

__STATIC_INLINE void XMC_I2C_CH_DisableDataTransmission ( XMC_USIC_CH_t *const  channel)
Parameters
channelConstant pointer to USIC channel handle of type XMC_USIC_CH_t
Range: XMC_I2C0_CH0, XMC_I2C0_CH1,XMC_I2C1_CH0,XMC_I2C1_CH1,XMC_I2C2_CH0,XMC_I2C2_CH1
Note
Availability of I2C1 and I2C2 depends on device selection
Returns
None
Description
Disable data transmission.

Use this function in combination with XMC_I2C_CH_EnableDataTransmission() to fill the FIFO and send the FIFO content without gaps in the transmission. FIFO is filled using XMC_USIC_CH_TXFIFO_PutData().
Related APIs:
XMC_I2C_CH_EnableDataTransmission()


Definition at line 769 of file xmc_i2c.h.

Here is the call graph for this function:

◆ XMC_I2C_CH_DisableEvent()

void XMC_I2C_CH_DisableEvent ( XMC_USIC_CH_t *const  channel,
uint32_t  event 
)
Parameters
channelConstant pointer to USIC channel structure of type XMC_USIC_CH_t
eventORed values of XMC_I2C_CH_EVENT_t enum
Returns
None
Description:
Disables the input parameter XMC_I2C_CH_EVENT_t event using PCR_IICMode register.
Related APIs:
XMC_I2C_CH_EnableEvent()

Definition at line 400 of file xmc_i2c.c.

◆ XMC_I2C_CH_DisableMasterClock()

__STATIC_INLINE void XMC_I2C_CH_DisableMasterClock ( XMC_USIC_CH_t *const  channel)
Parameters
channelA constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address.
Returns
None
Description:
Disables the generation of Master clock by clearing PCR.MCLK bit.

This clock can be enabled by invoking XMC_I2C_CH_EnableMasterClock() as needed in the program.
Related APIs:
XMC_I2C_CH_EnableMasterClock()

Definition at line 805 of file xmc_i2c.h.

◆ XMC_I2C_CH_EnableAcknowledgeAddress0()

__STATIC_INLINE void XMC_I2C_CH_EnableAcknowledgeAddress0 ( XMC_USIC_CH_t *const  channel)
Parameters
channelConstant pointer to USIC channel structure of type XMC_USIC_CH_t
Returns
None
Description:
Retrieves the status byte of I2C channel using PSR_IICMode register.
Related APIs:
XMC_I2C_CH_DisableAcknowledgeAddress0()

Definition at line 717 of file xmc_i2c.h.

◆ XMC_I2C_CH_EnableDataTransmission()

__STATIC_INLINE void XMC_I2C_CH_EnableDataTransmission ( XMC_USIC_CH_t *const  channel)
Parameters
channelConstant pointer to USIC channel handle of type XMC_USIC_CH_t
Range: XMC_I2C0_CH0, XMC_I2C0_CH1,XMC_I2C1_CH0,XMC_I2C1_CH1,XMC_I2C2_CH0,XMC_I2C2_CH1
Note
Availability of I2C1 and I2C2 depends on device selection
Returns
None
Description
Enable data transmission.

Use this function in combination with XMC_I2C_CH_DisableDataTransmission() to fill the FIFO and send the FIFO content without gaps in the transmission. FIFO is filled using XMC_USIC_CH_TXFIFO_PutData().
Note
If you need more control over the start of transmission use XMC_USIC_CH_SetStartTransmisionMode()
Related APIs:
XMC_I2C_CH_DisableDataTransmission()


Definition at line 751 of file xmc_i2c.h.

Here is the call graph for this function:

◆ XMC_I2C_CH_EnableEvent()

void XMC_I2C_CH_EnableEvent ( XMC_USIC_CH_t *const  channel,
uint32_t  event 
)
Parameters
channelConstant pointer to USIC channel structure of type XMC_USIC_CH_t
eventORed values of XMC_I2C_CH_EVENT_t enum
Returns
None
Description:
Enables the input parameter XMC_I2C_CH_EVENT_t event using PCR_IICMode register.
Related APIs:
XMC_I2C_CH_DisableEvent()

Definition at line 394 of file xmc_i2c.c.

◆ XMC_I2C_CH_EnableMasterClock()

__STATIC_INLINE void XMC_I2C_CH_EnableMasterClock ( XMC_USIC_CH_t *const  channel)
Parameters
channelA constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address.
Returns
None
Description:
Enables the generation of Master clock by setting PCR.MCLK bit.

This clock can be used as a clock reference for external devices. This is not enabled during initialization in XMC_I2C_CH_Init(). Invoke XMC_I2C_CH_EnableMasterClock() to enable as needed in the program, or if it is disabled by XMC_I2C_CH_DisableMasterClock().
Related APIs:
XMC_I2C_CH_DisableMasterClock()

Definition at line 788 of file xmc_i2c.h.

◆ XMC_I2C_CH_GetReceivedData()

uint8_t XMC_I2C_CH_GetReceivedData ( const XMC_USIC_CH_t *const  channel)
Parameters
channelConstant pointer to USIC channel structure of type XMC_USIC_CH_t
Returns
uint8_t OUTR/RBUF register data
Description:
Reads the data from I2C channel.
Data is read by using OUTR/RBUF register based on FIFO/non-FIFO modes.
Related APIs:
XMC_I2C_CH_MasterTransmit()

Definition at line 360 of file xmc_i2c.c.

◆ XMC_I2C_CH_GetReceiverStatusFlag()

__STATIC_INLINE uint8_t XMC_I2C_CH_GetReceiverStatusFlag ( XMC_USIC_CH_t *const  channel)
Parameters
channelConstant pointer to USIC channel structure of type XMC_USIC_CH_t
Returns
uint8_t Receiver status flag
Description:
Gets the receiver status of I2C channel using RBUF register of bits 8-12 which gives information about receiver status.
Related APIs:
XMC_I2C_CH_MasterTransmit()

Definition at line 619 of file xmc_i2c.h.

◆ XMC_I2C_CH_GetSlaveAddress()

uint16_t XMC_I2C_CH_GetSlaveAddress ( const XMC_USIC_CH_t *const  channel)
Parameters
channelConstant pointer to USIC channel handler of type XMC_USIC_CH_t
Returns
uint16_t Slave address
Description:
Gets the I2C channel slave address.
Returns the address using PCR_IICMode register by checking if it is in 10-bit address group or 7-bit address group.
(If first five bits of address are assigned with 0xF0, then address mode is considered as 10-bit mode otherwise it is 7-bit mode)
Note
A 7-bit address will include an additional bit at the LSB. For example, address 0x05 will be returned as 0x0a. 10-bit address will not include the 10-bit address identifier 0b11110xx at the most signifcant bits.
Related APIs:
XMC_I2C_CH_SetSlaveAddress()

Definition at line 146 of file xmc_i2c.c.

◆ XMC_I2C_CH_GetStatusFlag()

__STATIC_INLINE uint32_t XMC_I2C_CH_GetStatusFlag ( XMC_USIC_CH_t *const  channel)
Parameters
channelConstant pointer to USIC channel structure of type XMC_USIC_CH_t
Returns
uint32_t Status byte
Description:
Retrieves the status byte of I2C channel using PSR_IICMode register.
Related APIs:
XMC_I2C_CH_ClearStatusFlag()

Definition at line 660 of file xmc_i2c.h.

◆ XMC_I2C_CH_Init()

void XMC_I2C_CH_Init ( XMC_USIC_CH_t *const  channel,
const XMC_I2C_CH_CONFIG_t *const  config 
)
Parameters
channelConstant pointer to USIC channel structure of type XMC_USIC_CH_t
configConstant pointer to I2C channel config structure of type XMC_I2C_CH_CONFIG_t
Returns
None
Description:
Initializes the I2C channel.
Configures the data format in SCTR register. Sets the slave address, baud rate. Enables transmit data valid, clears status flags and disables parity generation.
Related APIs:
XMC_USIC_CH_Enable()

Definition at line 110 of file xmc_i2c.c.

◆ XMC_I2C_CH_MasterReceiveAck()

void XMC_I2C_CH_MasterReceiveAck ( XMC_USIC_CH_t *const  channel)
Parameters
channelConstant pointer to USIC channel structure of type XMC_USIC_CH_t
Returns
None
Description:
Sends the Ack request from I2C master channel.
Reads the transmit buffer status is busy or not and thereby updates IN/TBUF register based on FIFO/non-FIFO modes using Master Receive Ack command.
Related APIs:
XMC_I2C_CH_MasterTransmit()

Definition at line 316 of file xmc_i2c.c.

Here is the call graph for this function:

◆ XMC_I2C_CH_MasterReceiveNack()

void XMC_I2C_CH_MasterReceiveNack ( XMC_USIC_CH_t *const  channel)
Parameters
channelConstant pointer to USIC channel structure of type XMC_USIC_CH_t
Returns
None
Description:
Sends the Nack request from I2C master channel.
Reads the transmit buffer status is busy or not and thereby updates IN/TBUF register based on FIFO/non-FIFO modes using Master Receive Nack command.
Related APIs:
XMC_I2C_CH_MasterTransmit()

Definition at line 338 of file xmc_i2c.c.

Here is the call graph for this function:

◆ XMC_I2C_CH_MasterRepeatedStart()

void XMC_I2C_CH_MasterRepeatedStart ( XMC_USIC_CH_t *const  channel,
const uint16_t  addr,
const XMC_I2C_CH_CMD_t  command 
)
Parameters
channelConstant pointer to USIC channel structure of type XMC_USIC_CH_t
addrI2C master address
commandread/write command
Returns
None
Description:
Sends the repeated start condition from I2C master channel.
Sends the repeated start condition with read/write command by updating IN/TBUF register based on FIFO/non-FIFO modes.
Note
Address(addr) should reserve an additional bit at the LSB for read/write indication. For example, address 0x05 should be provided as 0x0a. If the address is 10-bit, only most significant bits with the 10-bit identifier should be sent using this function. For example, if the 10-bit address is 0x305, the address should be provided as 0xf6(prepend with 0b11110, upper two bits of address 0b11, followed by 1-bit field for read/write).
Related APIs:
XMC_I2C_CH_MasterTransmit(), XMC_USIC_CH_GetTransmitBufferStatus()

Definition at line 221 of file xmc_i2c.c.

◆ XMC_I2C_CH_MasterStart()

void XMC_I2C_CH_MasterStart ( XMC_USIC_CH_t *const  channel,
const uint16_t  addr,
const XMC_I2C_CH_CMD_t  command 
)
Parameters
channelConstant pointer to USIC channel structure of type XMC_USIC_CH_t
addrI2C master address
commandread/write command
Returns
None
Description:
Starts the I2C master channel.
Sends the Start condition with read/write command by updating IN/TBUF register based on FIFO/non-FIFO modes.
Note
Address(addr) should reserve an additional bit at the LSB for read/write indication. For example, address 0x05 should be provided as 0x0a. If the address is 10-bit, only most significant bits with the 10-bit identifier should be sent using this function. For example, if the 10-bit address is 0x305, the address should be provided as 0xf6(prepend with 0b11110, upper two bits of address 0b11, followed by 1-bit field for read/write).
Related APIs:
XMC_I2C_CH_MasterTransmit(), XMC_USIC_CH_GetTransmitBufferStatus()

Definition at line 192 of file xmc_i2c.c.

◆ XMC_I2C_CH_MasterStop()

void XMC_I2C_CH_MasterStop ( XMC_USIC_CH_t *const  channel)
Parameters
channelConstant pointer to USIC channel structure of type XMC_USIC_CH_t
Returns
None
Description:
Stops the I2C master channel.
Reads the transmit buffer status is busy or not and thereby updates IN/TBUF register based on FIFO/non-FIFO modes using Stop command.
Related APIs:
XMC_I2C_CH_MasterTransmit(), XMC_USIC_CH_GetTransmitBufferStatus()

Definition at line 250 of file xmc_i2c.c.

Here is the call graph for this function:

◆ XMC_I2C_CH_MasterTransmit()

void XMC_I2C_CH_MasterTransmit ( XMC_USIC_CH_t *const  channel,
const uint8_t  data 
)
Parameters
channelConstant pointer to USIC channel structure of type XMC_USIC_CH_t
datadata to transmit from I2C channel
Returns
None
Description:
Transmit the data from the I2C master channel.
Reads the transmit buffer status is busy or not and thereby updates IN/TBUF register based on FIFO/non-FIFO modes using Master Send command.
Related APIs:
XMC_USIC_CH_GetTransmitBufferStatus()

Definition at line 272 of file xmc_i2c.c.

Here is the call graph for this function:

◆ XMC_I2C_CH_SelectInterruptNodePointer()

__STATIC_INLINE void XMC_I2C_CH_SelectInterruptNodePointer ( XMC_USIC_CH_t *const  channel,
const XMC_I2C_CH_INTERRUPT_NODE_POINTER_t  interrupt_node,
const uint32_t  service_request 
)
Parameters
channelPointer to USIC channel handler of type XMC_USIC_CH_t
Range: XMC_I2C0_CH0, XMC_I2C0_CH1,XMC_I2C1_CH0,XMC_I2C1_CH1,XMC_I2C2_CH0,XMC_I2C2_CH1
Note
Availability of I2C1 and I2C2 depends on device selection
Parameters
interrupt_nodeInterrupt node pointer to be configured.
Range: XMC_I2C_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT, XMC_I2C_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER etc.
service_requestService request number.
Range: 0 to 5.
Returns
None
Description
Sets the interrupt node for USIC channel events.

For an event to generate interrupt, node pointer should be configured with service request(SR0, SR1..SR5). The NVIC node gets linked to the interrupt event by doing so.
Note: NVIC node should be separately enabled to generate the interrupt.
Related APIs:
XMC_I2C_CH_EnableEvent()


Definition at line 387 of file xmc_i2c.h.

Here is the call graph for this function:

◆ XMC_I2C_CH_SetBaudrate()

XMC_I2C_CH_STATUS_t XMC_I2C_CH_SetBaudrate ( XMC_USIC_CH_t *const  channel,
const uint32_t  rate 
)
Parameters
channelConstant pointer to USIC channel structure of type XMC_USIC_CH_t
ratebaud rate of I2C channel
Returns
None
Description:
Sets the rate of I2C channel.
Note:
Standard over sampling is considered if rate <= 100KHz and fast over sampling is considered if rate > 100KHz.
Related APIs:
XMC_USIC_CH_SetBaudrate()

Definition at line 162 of file xmc_i2c.c.

Here is the call graph for this function:

◆ XMC_I2C_CH_SetInputSource()

__STATIC_INLINE void XMC_I2C_CH_SetInputSource ( XMC_USIC_CH_t *const  channel,
const XMC_I2C_CH_INPUT_t  input,
const uint8_t  source 
)
Parameters
channelConstant pointer to USIC channel structure of type XMC_USIC_CH_t
inputI2C channel input stage of type XMC_I2C_CH_INPUT_t
sourceInput source select for the input stage(0->DX0A, 1->DX1A, .. 7->DX7G)
Returns
None
Description:
Sets the input source for I2C channel.
Defines the input stage for the corresponding input line.
Note
After configuring the input source for corresponding channel, interrupt node pointer is set.
Related APIs:
XMC_USIC_CH_SetInptSource(), XMC_USIC_CH_SetInterruptNodePointer()

Definition at line 431 of file xmc_i2c.h.

Here is the call graph for this function:

◆ XMC_I2C_CH_SetInterruptNodePointer()

__STATIC_INLINE void XMC_I2C_CH_SetInterruptNodePointer ( XMC_USIC_CH_t *const  channel,
const uint8_t  service_request 
)
Parameters
channelConstant pointer to USIC channel structure of type XMC_USIC_CH_t
service_requestService request number in the range of 0-5
Returns
None
Description:
Sets the interrupt node for protocol interrupt.
To generate interrupt for an event, node pointer should be configured with service request number(SR0, SR1..SR5). The NVIC node gets linked to the interrupt event by doing so.
Note:
NVIC node should be separately enabled to generate the interrupt. After setting the node pointer, desired event must be enabled.
Related APIs:
XMC_I2C_CH_EnableEvent(), NVIC_SetPriority(), NVIC_EnableIRQ(), XMC_I2C_CH_SetInputSource()

Definition at line 361 of file xmc_i2c.h.

Here is the call graph for this function:

◆ XMC_I2C_CH_SetSlaveAddress()

void XMC_I2C_CH_SetSlaveAddress ( XMC_USIC_CH_t *const  channel,
const uint16_t  address 
)
Parameters
channelConstant pointer to USIC channel structure of type XMC_USIC_CH_t
addressI2C slave address
Returns
None
Description:
Sets the I2C channel slave address.
Address is set in PCR_IICMode register by checking if it is in 10-bit address group or 7-bit address group. (If first five bits of address are assigned with 0xF0, then address mode is 10-bit mode otherwise it is 7-bit mode)
Note
A 7-bit address should include an additional bit at the LSB for read/write indication. For example, address 0x05 should be provided as 0x0a. A 10-bit address should be provided with the identifier 0b11110xx at the most significant bits. For example, address 0x305 should be provided as 0x7b05(bitwise OR with 0x7800).
Related APIs:
XMC_I2C_CH_GetSlaveAddress()

Definition at line 134 of file xmc_i2c.c.

◆ XMC_I2C_CH_SlaveTransmit()

void XMC_I2C_CH_SlaveTransmit ( XMC_USIC_CH_t *const  channel,
const uint8_t  data 
)
Parameters
channelConstant pointer to USIC channel structure of type XMC_USIC_CH_t
datadata to transmit from I2C channel
Returns
None
Description:
Transmit the data from the I2C slave channel.
Reads the transmit buffer status is busy or not and thereby updates IN/TBUF register based on FIFO/non-FIFO modes using Slave Send command.
Related APIs:
XMC_USIC_CH_GetTransmitBufferStatus(),XMC_I2C_CH_ClearStatusFlag()

Definition at line 294 of file xmc_i2c.c.

Here is the call graph for this function:

◆ XMC_I2C_CH_Start()

__STATIC_INLINE void XMC_I2C_CH_Start ( XMC_USIC_CH_t *const  channel)
Parameters
channelConstant pointer to USIC channel structure of type XMC_USIC_CH_t
Returns
None
Description:
Starts the I2C channel.
Sets the USIC input operation mode to I2C mode using CCR register.
Related APIs:
XMC_USIC_CH_SetMode()

Definition at line 322 of file xmc_i2c.h.

Here is the call graph for this function:

◆ XMC_I2C_CH_Stop()

XMC_I2C_CH_STATUS_t XMC_I2C_CH_Stop ( XMC_USIC_CH_t *const  channel)
Parameters
channelConstant pointer to USIC channel structure of type XMC_USIC_CH_t
Returns
XMC_I2C_CH_STATUS_t
Description:
Stops the I2C channel.
Sets the USIC input operation to IDLE mode using CCR register.
Related APIs:
XMC_USIC_CH_SetMode()

Definition at line 378 of file xmc_i2c.c.

◆ XMC_I2C_CH_TriggerServiceRequest()

__STATIC_INLINE void XMC_I2C_CH_TriggerServiceRequest ( XMC_USIC_CH_t *const  channel,
const uint32_t  service_request_line 
)
Parameters
channelPointer to USIC channel handler of type XMC_USIC_CH_t
Range: XMC_I2C0_CH0, XMC_I2C0_CH1,XMC_I2C1_CH0,XMC_I2C1_CH1,XMC_I2C2_CH0,XMC_I2C2_CH1
Note
Availability of I2C1 and I2C2 depends on device selection
Parameters
service_request_lineservice request number of the event to be triggered.
Range: 0 to 5.
Returns
None
Description
Trigger a I2C interrupt service request.

When the I2C service request is triggered, the NVIC interrupt associated with it will be generated if enabled.
Related APIs:
XMC_I2C_CH_SelectInterruptNodePointer()


Definition at line 410 of file xmc_i2c.h.

Here is the call graph for this function: